package main

import (
	"bufio"
	"fmt"
	"net"
	"os"
)

func main() {
	fmt.Println("client")
	tcpAddr, _ := net.ResolveTCPAddr("tcp", ":8888")

	conn, _ := net.DialTCP("tcp", nil, tcpAddr)
	// defer conn.Close()
	reader := bufio.NewReader(os.Stdin)
	for {
		fmt.Println("请输入：\n")
		bytes, _, _ := reader.ReadLine()
		// conn.Write([]byte("hello server"))
		conn.Write(bytes)
		but := make([]byte, 1024)
		conn.Read(but)
		fmt.Println("server:", string(but))
	}
}
